// pages/commonWeb/commonWeb.js
const app = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    url:''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var url = decodeURIComponent(options.url);
    // url = url + (url&&url.indexOf('?') > -1 ? '&' : '?') + "openId=" + app.globalData.openid + "&userId=" + app.globalData.userId + "&phoneNo=" + app.globalData.userMobile + "&queueId=12YJZQZ949Eb44iksv5g"
     // 点击消息进入线上随访
     if(options.type=='online'){
        console.log('options11',options)
        let {
            currentPatient,
            codeDeptId,
            config
        } = app.globalData
        let {
            tenantId
        } = currentPatient
        console.log('app.globalData',app.globalData)
        url = `https://xcx.bb-care.com/qmx/H5/view-html/scale/html/#/questionnaire/question?tenantId=${ tenantId }&deptId=${codeDeptId}&ptTaskId=${options.ptTaskId}&followQueueId=${options.followQueueId}`
        // url = `${ 'http://192.168.3.149:9020/#/questionnaire/question'}?tenantId=${ tenantId }&deptId=${codeDeptId}&ptTaskId=${options.ptTaskId}&followQueueId=${options.followQueueId}`
        // ${ url}?
        console.log('线上问卷',url)
        // https://xcx.bb-care.com/qmx/H5/view-html/scale/html/#/questionnaire/quest?tenantId=qmxxssfta001&deptId=qmxxssfdept001&ptTaskId=16bGHmseNGQv4n8ODb8q&followQueueId=qmxxssfJCBJqueue&userId=140Duumgfol2kLzgUl2f&queueId=qmxxssfJCBJqueue
    }
    this.setData({
        url:url+`?timestamp=${new Date().getTime()}`
    })
  },
})